from .error import *
class Cursor(object):
    def __init__(self,cnn):
        self.__cnn=cnn
        self.__description=None
        self.__rowcount=None
        self.arraysize=100
    def __getDescription(self):
        return self.__description
    def __getRowcount(self):
        return self.__rowcount
    description = property(__getDescription,None,None,'fields description')
    rowcount=property(__getRowcount,None,None,'row count')
    def execute(self,operation,*param):
        cnn=self.__cnn
        retval = cnn._Connection__execute(operation,param)
        if retval[0]==1:
            raise DatabaseError(retval[1])
        else:
            self.__description=retval[1]
            self.__rowcount=cnn._Connection__rowcount()
    def close(self):
        self.__cnn._Connection__resultClose()
